<template>
	<view class="seat-item" @click="onClick">
		<text style="" class="lie" v-if="index == 0">{{item.col_code}}</text>
		<!--
		<view class="seat-icon">
			<template v-if="(cStatus==1 && refund_order !=2) || status==1">
				<image v-if="cStatus==1 && refund_order !=2" class="image" src="/static/images/seat_2.png"></image>
				<image v-if="status == 1" class="image" src="/static/images/seat_00.png"></image>
			</template>
			<template v-else>
				<image v-if="!checked" class="image" src="/static/images/seat_0.png"></image>
				<image v-if="checked" class="image" src="/static/images/seat_1.png"></image>
			</template>
		</view>
		-->
		<view class="seat-icon">
			<template v-if="status == 2"><!-- 已售 -->
				<template v-if="isGroup">
					<image class="image" src="/static/images/seat_3.png"></image>
				</template>
				<template v-else>
					<image class="image" src="/static/images/seat_2.png"></image>
				</template>
			</template>
			<template v-else-if="status == 1"><!-- 不可选 -->
				<image class="image" src="/static/images/seat_u-2.png"></image>
			</template>
			<template v-else-if="status == 3"><!-- 空位（空白） -->
				<image class="image" src="/static/images/seat_00.png"></image>
			</template>
			<template v-else-if="status == 4"><!-- 已团购 -->
				<image class="image" src="/static/images/seat_3.png"></image>
			</template>
			<template v-else><!-- 可选 -->
				<image v-if="!checked" class="image" src="/static/images/seat_0.png"></image>
				<image v-if="checked" class="image" src="/static/images/seat_1.png"></image>
			</template>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			checked: {
				type: Boolean,
				default: false
			},
			isGroup: {
				type: Boolean,
				default: false
			},
			status: {
				type: Number,
				default: 0
			},
			index: {
				type: Number,
				default: 0
			},
			cStatus: {
				type: Number,
				default: 0
			},
			refund_order: {
				type: Number,
				default: 0
			},
			item: {
				type: Object,
				default: {}
			},
			c_add_time: {
				type: Number,
				default: 0
			},
			
		},
		computed:{
			ischeck(){
				if ((this.cStatus==1 && this.refund_order !=2) || this.status==1 || this.status==2 || this.status==3 || this.status==4 || (this.cStatus==0 && (this.item.c_add_time*1000 + 10*60*1000) > new Date().getTime()) ){
					return true
				}else{
					return false
				}
			}
		},
		methods: {
			onClick() {
				if (this.ischeck) {
					
				}else{
					this.$emit('click')
				}
			}
		}
	}
</script>

<style lang="scss">
	.seat-item {
		flex: 0 0 10%;

		.seat-icon {
			width: 50rpx;
			height: 50rpx;

			.image {
				width: 100%;
				height: 100%;
			}
		}
	}

	.lie {
		width: 50rpx;
		text-align: center;
		font-size: 24rpx;
		display: block;
		height: 20px;
		color: #CCCCCC;
		line-height: 20px;
		position: absolute;
		top: 0;
	}
</style>
